home *** CD-ROM | disk | FTP | other *** search
- /*
-
- Miranda IM: the free IM client for Microsoft* Windows*
- This is a modified copy of Miranda IM's Language Pack module.
- Modified on: November 21st, 2003
-
- Copyright 2000-2003 Miranda ICQ/IM project,
- all portions of this codebase are copyrighted to the people
- listed in contributors.txt.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
- #include "../MirandaInstaller.h"
- #pragma hdrstop
-
- static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd,LPARAM lParam)
- {
- char title[2048],szClass[32];
- int id=GetDlgCtrlID(hwnd);
-
- GetClassName(hwnd,szClass,sizeof(szClass));
- if(!lstrcmpi(szClass,"static") || !lstrcmpi(szClass,"hyperlink") || !lstrcmpi(szClass,"button") || !strcmpi(szClass,"MButtonClass")) {
- GetWindowText(hwnd,title,sizeof(title));
- SetWindowText(hwnd,Translate(title));
- }
- else if(!lstrcmpi(szClass,"edit")) {
- if(GetWindowLong(hwnd,GWL_STYLE)&ES_READONLY) {
- GetWindowText(hwnd,title,sizeof(title));
- SetWindowText(hwnd,Translate(title));
- }
- }
- return TRUE;
- }
-
-
- void LP_TranslateMenu(HMENU hMenu)
- {
- int i;
- MENUITEMINFO mii;
- char str[256];
-
- mii.cbSize = sizeof(MENUITEMINFO);
- for(i=GetMenuItemCount(hMenu)-1;i>=0;i--) {
- mii.fMask=MIIM_TYPE|MIIM_SUBMENU;
- mii.dwTypeData=str;
- mii.cch=sizeof(str);
- GetMenuItemInfo(hMenu,i,TRUE,&mii);
- if(mii.cch) {
- mii.dwTypeData=Translate(mii.dwTypeData);
- mii.fMask=MIIM_TYPE;
- SetMenuItemInfo(hMenu,i,TRUE,&mii);
- }
- if(mii.hSubMenu!=NULL) LP_TranslateMenu(mii.hSubMenu);
- }
- }
-
-
- void LP_TranslateDialog(HWND hwndDlg)
- {
- // always work out the title
- char title[256];
- GetWindowText(hwndDlg,title,sizeof(title));
- SetWindowText(hwndDlg,Translate(title));
-
- // menu
- HMENU hMenu = GetMenu(hwndDlg);
- if (hMenu)
- {
- LP_TranslateMenu(hMenu);
- }
-
- EnumChildWindows(hwndDlg,TranslateDialogEnumProc,0);
- }